﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace Soket_MMTNC_Server
{
    class User
    {
        public string name { set; get; }
        public string username { set; get; }
        public string password { set; get; }

        public bool Login(string username,string password)
        {
            XDocument doc = XDocument.Load("../../databases/users.xml");

            IEnumerable<System.Xml.Linq.XElement> product = from p in doc.Descendants("user")
                                                            where p.Element("username").Value == username &&
                                                                    p.Element("password").Value == password
                                                            select p;
            if (product.Count() > 0)
            {
                return true;
            }
            return false;
        }
    }
}
